<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
                exclude-result-prefixes="msxsl">

  <xsl:output method="html" indent="no"/>
  <xsl:decimal-format NaN=""/>
  <xsl:param name="XmlDefinition" select="."/>

  <xsl:template match="/">
    <p>This is rendered through custom XSLT</p>
    <table cellpadding="3">
      <tr>
        <xsl:for-each select="$XmlDefinition/ViewFields/FieldRef">
          <th>
            <xsl:value-of select="@DisplayName"/>
          </th>
        </xsl:for-each>
      </tr>
      <xsl:for-each select="/dsQueryResponse/Rows/Row">
        <tr>
          <xsl:variable name="row" select="." />
          <xsl:for-each select="$XmlDefinition/ViewFields/FieldRef">
            <xsl:variable name="fieldName" select="@Name" />
            <td>
              <xsl:value-of select="$row/@*[name() = $fieldName]" disable-output-escaping="yes"/>
            </td>
          </xsl:for-each>
        </tr>
      </xsl:for-each>
    </table>
  </xsl:template>
</xsl:stylesheet>